package com.memoir.jpa.model;

import lombok.Data;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.Date;

@Entity
@Table(name = "t_todo")
@Data
@EntityListeners(AuditingEntityListener.class)  //指定监听
public class TodoDto {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    @Column(name = "title")
    private String title;

    @Column(name = "content")
    private String content;

    @CreatedDate
    @Column(name = "create_time")
    private Date createTime;

    @LastModifiedDate
    @Column(name = "modify_time")
    private Date modifyTime;

    @CreatedBy
    @Column(name = "create_by")
    private String createUser;

    @Column(name = "modify_by")
    @LastModifiedBy
    private String modifyUser;

    @Column(name = "completed")
    private Boolean completed;
}
